package cn.wolfcode.wolf2w.domain;

import com.alibaba.fastjson.JSON;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.HashMap;
import java.util.Map;

/**
 * 游记推荐
 */

@Document("banner")
public class Banner  extends BaseDomain {
    public static final int STATE_NORMAL = 0;   //正常
    public static final int STATE_DISABLE = 1;  //禁用

    public static final int TYPE_TRAVEL = 1;  //游记
    public static final int TYPE_STRATEGY = 2;  //攻略

    private String refId;  //关联id

    private String title;  //标题

    private String subTitle; //副标题

    private String coverUrl; //封面

    private int state = STATE_NORMAL; //状态

    private int sequence; //排序

    private int type;

    public String getJsonString(){
        Map<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("title",title);
        map.put("subTitle",subTitle);
        map.put("coverUrl",coverUrl);
        map.put("state",state);
        map.put("sequence",sequence);
        map.put("refId",refId);
        map.put("type",type);
        return JSON.toJSONString(map);
    }

    public String getStateDisplay(){
        return state == STATE_NORMAL?"正常":"禁用";
    }
    public String getTypeDisplay(){
        return type == TYPE_STRATEGY?"攻略":"游记";
    }

    public static int getStateNormal() {
        return STATE_NORMAL;
    }

    public static int getStateDisable() {
        return STATE_DISABLE;
    }

    public static int getTypeTravel() {
        return TYPE_TRAVEL;
    }

    public static int getTypeStrategy() {
        return TYPE_STRATEGY;
    }

    public String getRefId() {
        return refId;
    }

    public void setRefId(String refId) {
        this.refId=refId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title=title;
    }

    public String getSubTitle() {
        return subTitle;
    }

    public void setSubTitle(String subTitle) {
        this.subTitle=subTitle;
    }

    public String getCoverUrl() {
        return coverUrl;
    }

    public void setCoverUrl(String coverUrl) {
        this.coverUrl=coverUrl;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state=state;
    }

    public int getSequence() {
        return sequence;
    }

    public void setSequence(int sequence) {
        this.sequence=sequence;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type=type;
    }
}